package org.fuxia.im.gui;

import java.awt.BorderLayout;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import javax.swing.ImageIcon;
import java.awt.Insets;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.SwingConstants;
import javax.swing.JButton;
import javax.swing.border.TitledBorder;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class ChangeHead extends JFrame {


	private static final long serialVersionUID = 1L;
	private JPanel contentPane;
	
	/**
	 * Create the frame.
	 */
	public ChangeHead() {
		setTitle("更换头像");
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		setBounds(100, 100, 600, 460);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		setContentPane(contentPane);
		
		JPanel panel = new JPanel();
		contentPane.add(panel, BorderLayout.CENTER);
		panel.setLayout(new BorderLayout(0, 0));
		
		JLabel titleLab = new JLabel("系统头像\r\n");
		panel.add(titleLab, BorderLayout.NORTH);
		
		JPanel allHeadPan = new JPanel();
		allHeadPan.setBorder(new TitledBorder(null, "", TitledBorder.LEADING, TitledBorder.TOP, null, null));
		panel.add(allHeadPan, BorderLayout.CENTER);
		GridBagLayout gbl_allHeadPan = new GridBagLayout();
		gbl_allHeadPan.columnWidths = new int[]{0, 0, 0};
		gbl_allHeadPan.rowHeights = new int[]{0, 0};
		gbl_allHeadPan.columnWeights = new double[]{0.0, 0.0, Double.MIN_VALUE};
		gbl_allHeadPan.rowWeights = new double[]{0.0, Double.MIN_VALUE};
		allHeadPan.setLayout(gbl_allHeadPan);
		
		JLabel lblNewLabel_1 = new JLabel("");
		lblNewLabel_1.setIcon(new ImageIcon(ChangeHead.class.getResource("/images/476AD[IG84KTKB~II5DR32T.jpg")));
		GridBagConstraints gbc_lblNewLabel_1 = new GridBagConstraints();
		gbc_lblNewLabel_1.insets = new Insets(0, 0, 0, 5);
		gbc_lblNewLabel_1.gridx = 0;
		gbc_lblNewLabel_1.gridy = 0;
		allHeadPan.add(lblNewLabel_1, gbc_lblNewLabel_1);
		
		JLabel lblNewLabel_2 = new JLabel("");
		lblNewLabel_2.setIcon(new ImageIcon(ChangeHead.class.getResource("/images/tangling.jpg")));
		GridBagConstraints gbc_lblNewLabel_2 = new GridBagConstraints();
		gbc_lblNewLabel_2.gridx = 1;
		gbc_lblNewLabel_2.gridy = 0;
		allHeadPan.add(lblNewLabel_2, gbc_lblNewLabel_2);
		
		JPanel showHeadPan = new JPanel();
		contentPane.add(showHeadPan, BorderLayout.EAST);
		
		JLabel label = new JLabel("预览");
		
		JLabel head60X60 = new JLabel("");
		head60X60.setIcon(new ImageIcon(ChangeHead.class.getResource("/images/head.jpg")));
		
		JLabel Lab60X60 = new JLabel("60X60");
		Lab60X60.setHorizontalAlignment(SwingConstants.CENTER);
		
		JLabel head100X100 = new JLabel("");
		head100X100.setIcon(new ImageIcon(ChangeHead.class.getResource("/images/head2.jpg")));
		
		JLabel lab100X100 = new JLabel("100X100");
		lab100X100.setHorizontalAlignment(SwingConstants.CENTER);
		GroupLayout gl_showHeadPan = new GroupLayout(showHeadPan);
		gl_showHeadPan.setHorizontalGroup(
			gl_showHeadPan.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_showHeadPan.createSequentialGroup()
					.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
					.addGroup(gl_showHeadPan.createParallelGroup(Alignment.LEADING)
						.addGroup(Alignment.TRAILING, gl_showHeadPan.createSequentialGroup()
							.addComponent(label, GroupLayout.PREFERRED_SIZE, 107, GroupLayout.PREFERRED_SIZE)
							.addContainerGap())
						.addGroup(Alignment.TRAILING, gl_showHeadPan.createSequentialGroup()
							.addGroup(gl_showHeadPan.createParallelGroup(Alignment.TRAILING, false)
								.addComponent(Lab60X60, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
								.addComponent(head60X60, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 60, Short.MAX_VALUE))
							.addGap(28))
						.addGroup(Alignment.TRAILING, gl_showHeadPan.createSequentialGroup()
							.addComponent(head100X100)
							.addGap(8))
						.addGroup(Alignment.TRAILING, gl_showHeadPan.createSequentialGroup()
							.addComponent(lab100X100, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE)
							.addGap(26))))
		);
		gl_showHeadPan.setVerticalGroup(
			gl_showHeadPan.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_showHeadPan.createSequentialGroup()
					.addContainerGap()
					.addComponent(label)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(head60X60, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(ComponentPlacement.UNRELATED)
					.addComponent(Lab60X60)
					.addPreferredGap(ComponentPlacement.UNRELATED)
					.addComponent(head100X100, GroupLayout.PREFERRED_SIZE, 100, GroupLayout.PREFERRED_SIZE)
					.addGap(18)
					.addComponent(lab100X100)
					.addContainerGap(157, Short.MAX_VALUE))
		);
		showHeadPan.setLayout(gl_showHeadPan);
		
		JPanel buttonPan = new JPanel();
		buttonPan.setBorder(new TitledBorder(null, "", TitledBorder.LEADING, TitledBorder.TOP, null, null));
		contentPane.add(buttonPan, BorderLayout.SOUTH);
		buttonPan.setLayout(new BorderLayout(0, 0));
		
		JPanel panel_4 = new JPanel();
		buttonPan.add(panel_4, BorderLayout.EAST);
		
		JButton ok = new JButton("   确定   ");
		panel_4.add(ok);
		
		JButton cancel = new JButton("   取消   ");
		cancel.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				dispose() ;
			}
		});
		panel_4.add(cancel);
	}

}
